/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.ui.dialogs;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.uml2.uml.ValueSpecification;

import com.cea.papyrus.core.utils.Debug;


/**
 * 
 */
public class ValueSpecificationDialog extends Dialog{
	
	/**
	 * 
	 */
	protected Combo combo;
	
	/**
	 * 
	 */
	protected Text nameField;
	
	/**
	 * 
	 */
	protected String announce="Create your ValueSpecification";
	
	/**
	 * 
	 */
	protected int channel=19;
	
	/**
	 * 
	 */
	protected ValueSpecification value=null;
	
	/**
	 * 
	 */
	protected Label nameLabel;
	
	/**
	 * 
	 * 
	 * @param parentShell 
	 */
	public ValueSpecificationDialog(Shell parentShell){
		super(parentShell);
		Debug.debug(this,"ValueSpecificationDialog", channel);
	}
	
	/**
	 * 
	 * 
	 * @param parent 
	 * 
	 * @return 
	 */
	@Override
	protected Control createDialogArea(Composite parent){
		Composite comp=(Composite)super.createDialogArea(parent);
		
		GridLayout layout=(GridLayout)comp.getLayout();
		layout.numColumns=2;
		Label elementlabel =new Label(comp, SWT.RIGHT|SWT.SINGLE);
		elementlabel.setText(announce);
		
		
		nameField =new Text(comp, SWT.SINGLE);
		nameField.setSize(300, 20);
		GridData data= new GridData(GridData.FILL_HORIZONTAL);
		nameField.setLayoutData(data);
		data.widthHint=250;
		return comp;
	}
	
	/**
	 * 
	 * 
	 * @param parent 
	 */
	@Override
	protected void createButtonsForButtonBar(Composite parent){
		super.createButtonsForButtonBar(parent);
		
	}
	
	/**
	 * 
	 * 
	 * @param buttonId 
	 */
	@Override
	protected void buttonPressed(int buttonId){
		super.buttonPressed(buttonId);
	}
	
	/**
	 * 
	 */
	@Override
	protected void okPressed(){
		
		Debug.debug(this,"actrion..."+nameField.getText(), channel);
		super.okPressed();
	}

	/**
	 * 
	 * 
	 * @return 
	 */
	public Object getValue(){
		return value;
	}
}
